package com.android.mios.adapter;

import com.android.mios.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class GalleryFunctionAdapter extends BaseAdapter {
	private String[] galleryDataList;
	//private Context ctx;
	private LayoutInflater mInflater;
	private int curPosition;

	public GalleryFunctionAdapter(Context context, String[] galleryDataList) {
		//ctx = context;
		this.galleryDataList = galleryDataList;
		mInflater = LayoutInflater.from(context);
	}

	public int getCurrposition() {
		return curPosition;
	}

	public void setCurposition(int curPosition) {
		this.curPosition = curPosition;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return galleryDataList.length;
	}

	@Override
	public String getItem(int postion) {
		// TODO Auto-generated method stub
		return galleryDataList[postion];
	}

	@Override
	public long getItemId(int postion) {
		// TODO Auto-generated method stub
		return postion;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		String date = galleryDataList[position];
		ViewHolder viewHolder = null;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.gallery_items, null);
			viewHolder.tvTitle = (TextView) convertView
					.findViewById(R.id.txt_title);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.tvTitle.setText(date);

		return convertView;
	}

	static class ViewHolder {
		public TextView tvTitle;

	}

}
